#!/usr/bin/python
# Copyright 2011, Kitware, Inc.

import sys

if len(sys.argv) == 2:
    filename = sys.argv[1]
else:
    filename = '/home/tutorial/Tutorial/Data/cthead1.png'

import SimpleITK as sitk
import pylab

image = sitk.ReadImage(filename)
a = sitk.GetArrayFromImage(image)


# Plot the histogram
pylab.figure()
pylab.hist(a.flatten())
pylab.show()

# Part 1: Smooth image and plot the histogram

# Part 2: Threshold the image to extract bone